<!--
  @author mujunlin
  @since 2019/08/15 10:59
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:replace="common/common :: jscss"/>
</head>
<body>
<div class="layui-fluid">

    <blockquote class="layui-crumb">组织关系&nbsp;&nbsp;>
        <a lay-href="/company/list.action">公司管理</a>&nbsp;&nbsp;>&nbsp;
        <zmn th:text="${(company.companyId == null||company.companyId == 0) ? '新增公司':company.name}">新增或修改公司</zmn>
    </blockquote>

    <div class="layui-card">
        <div th:replace="company/_tab::tab"></div>
        <div class="layui-card-body">
            <form method="POST" action="" class="layui-form" lay-filter="zmn-form">
                <!--用于保存或传值的隐藏表单元素
                   置于form标签内的最上方
                   -->
                <input type="hidden" th:value="${company.companyId}" name="companyId"/>

                <div class="layui-card-header layui-margin-b"><b>基本信息</b></div>
                <div class="layui-form-item layui-form-item-sm" th:if="${company.companyId>0}">
                    <label class="layui-form-label">公司ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">
                            <span th:text="${company.companyId}"></span>&nbsp;&nbsp;
                            <th:block th:switch="${company.status}">
                                <span th:case="2" class="layui-badge layui-bg-green">正常</span>
                                <span th:case="1" class="layui-badge layui-btn-danger">停用</span>
                            </th:block>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">公司简称：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="name" placeholder="公司简称" lay-verify="required"
                               lay-verType="tips" th:value="${company.name}"
                               autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">公司注册名称：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="fullName" placeholder="公司注册名称" lay-verify="required"
                               lay-verType="tips" th:value="${company.fullName}"
                               autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">公司注册时间：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" class="layui-input" placeholder="yyyy-MM-dd"
                               autocomplete="off" lay-verify="required" name="registTime" id="registTime"
                               style="background-color: #EEEEEE" th:value="${#dates.format(company.registTime, 'yyyy-MM-dd')}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">公司类型：</label>
                    <div class="layui-input-inline">
                        <select name="type" lay-verify="required" th:disabled="${company.companyId != null && company.companyId != ''}"
                                lay-filter="type" id="type"  lay-search>
                            <option value="">全部</option>
                            <option th:each="type:${types}" th:selected="${type.key == company.type}" th:value="${type.key}" th:text="${type.value}">
                            </option>
                        </select>
                    </div>
                    <div class="layui-input-inline" id="childTypeDiv" th:style="${#lists.isEmpty(sonTypes) ? 'display: none' : ''}">
                        <select name="childType" th:disabled="${company.companyId != null && company.companyId != ''}"
                                lay-filter="childType" id="childType"  lay-search>
                            <option value="">全部</option>
                            <option th:each="type:${sonTypes}" th:selected="${type.key == company.childType}" th:value="${type.key}" th:text="${type.value}">
                            </option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">所在城市区域：</label>
                    <div class="layui-input-inline">
                        <select id="provinceId" name="provinceId"
                                lay-filter="provinceId" lay-verify="required" lay-search>
                            <option value="">选择省</option>
                            <zmn th:each="province:${provinces}">
                                <option th:value="${province.areaId}" th:selected="${province.areaId == company.provinceId}"
                                        th:text="${province.name}"></option>
                            </zmn>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select id="cityId" name="cityId" lay-filter="cityId" lay-verify="required" lay-search>
                            <option value="">选择市</option>
                            <option th:each="city:${citys}" th:value="${city.areaId}" th:selected="${city.areaId == company.cityId}"
                                    th:text="${city.name}"></option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select id="countyId" name="countyId" lay-verify="required" lay-search>
                            <option value="">选择区/县</option>
                            <option th:each="district:${districts}" th:value="${district.areaId}"
                                    th:selected="${district.areaId == company.countyId}"
                                    th:text="${district.name}"></option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">组织架构：</label>
                    <div class="layui-input-inline">
                        <select id="plat" name="plat"
                                lay-filter="plat" lay-verify="required" lay-search th:disabled="${company.companyId!=null && company.companyId>0}">
                            <option value="">选择一级</option>
                                <option th:value="${organ.orgId}" th:selected="${organ.orgId == company.plat}"
                                        th:text="${organ.orgName}" th:each="organ:${organOneList}"></option>
                        </select>
                    </div>
                    <div class="layui-input-inline"  th:style="${(company.type==100||company.type>= 200) ? 'display: none' : ''}" id="orgTwoIdDiv">
                        <select id="orgTwoId" name="orgTwoId" lay-filter="orgTwoId"  lay-search >
                            <option value="">选择二级</option>
                            <option th:each="organ:${organTwoList}" th:value="${organ.orgId}" th:selected="${organ.orgId == company.orgTwoId}"
                                    th:text="${organ.orgName}"></option>
                        </select>
                    </div>
                    <div class="layui-input-inline"  th:style="${(company.type==100||company.type==110||company.type>= 200) ? 'display: none' : ''}" id="orgThrIdDiv">
                        <select id="orgThrId" name="orgThrId" lay-search>
                            <option value="">选择三级</option>
                            <option th:each="organ:${organThrList}" th:value="${organ.orgId}"
                                    th:selected="${organ.orgId == company.orgThrId}"
                                    th:text="${organ.orgName}"></option>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">详细地址：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="address" placeholder="地址具体门到牌号" lay-verify="required|size" lay-verType="tips"
                               th:value="${company.address}" autocomplete="off" class="layui-input" maxlength="100"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">公司简介：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <textarea name="brief" placeholder="公司简介" class="layui-textarea" th:text="${company.brief}"></textarea>
                    </div>
                </div>


                <div class="layui-card-header layui-margin-b"><b>联系信息</b></div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系人：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="contact" placeholder="联系人"
                               lay-verType="tips" th:value="${company.contact}"
                               autocomplete="off" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">联系人手机1：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="mobile" placeholder="联系人手机1" lay-verType="tips" lay-verify="mobile|required"
                               th:value="${company.mobile}" autocomplete="off" class="layui-input" maxlength="11"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系人手机2：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="mobile2" placeholder="联系人手机2"
                               lay-verType="tips" th:value="${company.mobile2}" lay-verify="mobile"
                               autocomplete="off" class="layui-input" maxlength="11"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系人电话1：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="phone" placeholder="联系人电话1" lay-verify="num"
                               lay-verType="tips" th:value="${company.phone}"
                               autocomplete="off" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系人电话2：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="phone2" placeholder="联系人电话2" lay-verify="num"
                               lay-verType="tips" th:value="${company.phone2}"
                               autocomplete="off" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客服电话：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="servicePhone" placeholder="客服电话" lay-verify="num"
                               lay-verType="tips" th:value="${company.servicePhone}"
                               autocomplete="off" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">技术电话：</label>
                    <div class="layui-input-inline" style="width:590px">
                        <input type="text" name="techPhone" placeholder="技术电话" lay-verify="num"
                               lay-verType="tips" th:value="${company.techPhone}"
                               autocomplete="off" class="layui-input" maxlength="20"/>
                    </div>
                </div>

                <zmn th:if="${company.companyId > 0}">
                    <div class="layui-card-header layui-margin-b"><b>其他信息</b></div>
                    <div class="layui-form-item layui-form-item-xs">
                        <label class="layui-form-label">修改人/时间</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${company.updater} + '&nbsp;/&nbsp;' + ${#dates.format(company.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
                                修改人/时间
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-item-xs">
                        <label class="layui-form-label">创建人/时间</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${company.creater} + '&nbsp;/&nbsp;' + ${#dates.format(company.createTime, 'yyyy-MM-dd HH:mm:ss')}">
                                创建人/时间
                            </div>
                        </div>
                    </div>
                </zmn>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button lay-submit="" lay-filter="zmn-form-submit" class="layui-btn" id="subBtn"
                                th:if="${#authPermit.checkPermit('/company/addEdit.action')}">提交
                        </button>
                        <button type="button" class="layui-btn-primary layui-btn cancleBtn">取消</button>
                    </div>
                </div>
            </form>
        </div>


    </div>
</div>
<script type="text/javascript" th:inline="javascript">
    let json = {
        company: [[${company}]]
    };

    layui.config({
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        art_company_detail: "company/zmn.art.company.detail",
    }).use(['index', 'art_company_detail']);

</script>
</body>
</html>